/*
Dominique Jannone
Guillaume Marre
Yohan Ojeda
Laurent Schiavon
*/
package model;

import java.util.logging.Level;
import java.util.logging.Logger;

class MonitorConnexion extends Thread {
	boolean activ;
	int cptcour;
	int cptpre;
	// log
			public static final Logger logger = Logger.getLogger(MonitorConnexion.class.getName());
	
	MonitorConnexion(){
	    activ = true;
	}
	public void run(){
	    while (activ){
		cptpre = cptcour;
		cptcour = MainServer.canalUser.getCpt();
		MainServer.debitCanalUser = (cptcour-cptpre);
		//logger.log(Level.INFO,"connexion user " + debitCanalUser + "/s");
		try{
		    sleep(1000);
		}catch(InterruptedException e){
			logger.log(Level.SEVERE,e.getClass() + ": " +  e.getMessage(), e);
		}
	    }
	}
	void terminate(){
	    activ = false;
	}
    }
